<template>
  <div>
    <div>
      <div>&nbsp;&nbsp;</div>
      <div>&nbsp;&nbsp;</div>
      <div>&nbsp;&nbsp;</div>

      <FieldPicker
        v-model="form.sale_order_template_id"
        label="咨询问诊费"
        :show="true"
        :options="options"
      />

      <van-button type="primary" @click.native="submit">
        ok
      </van-button>

      <div>
        <!-- {{ partner }} -->
      </div>
    </div>
  </div>
</template>

<script>
import FieldPicker from '@/components/Field/FieldPicker'

export default {
  name: 'MeConsultant',
  components: { FieldPicker },
  directives: {},
  filters: {},
  // mixins: [],
  props: {},

  data() {
    return {
      form: {}
    }
  },
  computed: {
    options: function() {
      return this.$store.state.consultFee.options
    },

    partner_id: function() {
      return this.$store.state.user.partner_id
    }
  },
  async created() {
    console.log('partner', this.partner_id)
    await this.$store.dispatch('ResPartnerEmp/browse_one', {
      id: this.partner_id
    })

    console.log('ResPartnerEmp')
    const sot = this.$store.state.ResPartnerEmp.dataDict.sale_order_template_id
    this.form = { id: this.partner_id, sale_order_template_id: sot }

    await this.$store.dispatch('consultFee/search_option')
    const res = this.$store.state.consultFee.options
    console.log('sot', res)
  },

  methods: {
    async submit() {
      console.log('xxx, click item,', this.form)
      await this.$store.dispatch('ResPartnerEmp/write', { values: this.form })
      this.$router.back()
    }
  }
}
</script>

<style type="text/css"></style>
